﻿using System;
using System.Runtime.Serialization;
using K9Nano.Share.Extensions;

namespace K9Nano.Share.Exceptions
{
    [Serializable]
    public class EntityNotFoundException : K9Exception
    {
        public EntityNotFoundException()
        {
        }

        public EntityNotFoundException(string message) : base(message)
        {
        }

        public EntityNotFoundException(string message, Exception inner) : base(message, inner)
        {
        }

        protected EntityNotFoundException(
            SerializationInfo info,
            StreamingContext context) : base(info, context)
        {
        }

        public EntityNotFoundException(Type entityType, long key)
            : this($"主键为{key}的{entityType.GetFriendlyName()}不存在")
        {

        }

        public EntityNotFoundException(Type entityType, string key)
            : this($"主键为{key}的{entityType.GetFriendlyName()}不存在")
        {

        }
    }
}